package com.lyc.day1104.demo02;

import java.util.ArrayList;
import java.util.Collections;

/**
 * @author ：Xiaochen
 * @date ：Created in 2022/11/4 21:01
 * @description：
 * @modified By：
 * @version:
 */
public class Test04 {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        Collections.addAll(list,"大娃","二娃","三娃","四娃","五娃","六娃","七娃","老爷爷","蛇精","蝎子精");

        ArrayList<String> newList = new ArrayList<>();
        for (String n:list){
            if (n.startsWith("大")){
                newList.add(n);
            }
        }

        ArrayList<String> newList2 = new ArrayList<>();
        for (String n : newList){
            if (n.length()==2){
                newList2.add(n);
            }
        }
        System.out.println(newList2);
    }
}